package com.sw.small_world.fragment.smallworld;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.sw.small_world.R;
import com.sw.small_world.activity.MainActivity;
import com.sw.small_world.fragment.base.BaseFragment;
import com.sw.small_world.utils.CommonUtils;
import com.sw.small_world.utils.ConstantUtils;
import com.sw.small_world.utils.StartUtils;
import com.sw.small_world.utils.ToastUtil;
import com.sw.small_world.widgets.CircleImageView;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2017/3/16.
 */

public class SmallWorldFragment extends BaseFragment {

    @Bind(R.id.iv_portrait)
    CircleImageView ivPortrait;
    @Bind(R.id.tv_mai_zhi)
    TextView tvMaiZhi;
    @Bind(R.id.tv_friends_num)
    TextView tvFriendsNum;
    @Bind(R.id.tv_job_area)
    TextView tvJobArea;
    @Bind(R.id.tv_name)
    TextView tvName;
    @Bind(R.id.tv_company)
    TextView tvCompany;
    @Bind(R.id.tv_position)
    TextView tvPosition;
    @Bind(R.id.tv_address)
    TextView tvAddress;
    @Bind(R.id.like)
    ImageView like;
    @Bind(R.id.unlike)
    ImageView unlike;
    private MainActivity activity;

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        activity = (MainActivity) getActivity();
        activity.ivRight.setVisibility(View.VISIBLE);
        activity.ivRight.setImageDrawable(CommonUtils.getDrawable(R.drawable.xiaoshijie_renmai));
        activity.ivRight.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                StartUtils.startActivityById(activity,R.id.item_my_friends);
            }
        });
    }

    @Override
    protected Object requestData() {
        return ConstantUtils.STATE_SUCCESSED;
    }

    @Override
    protected View getSuccessView() {
        View view = View.inflate(activity, R.layout.fragment_small_world, null);
        ButterKnife.bind(this,view);
        return view;
    }

    @OnClick({R.id.like, R.id.unlike})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.like:
                ToastUtil.show("感兴趣");
                break;
            case R.id.unlike:
                ToastUtil.show("不感兴趣");
                break;
        }
    }
    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.unbind(this);
    }
}
